package com.tuanzi.loan.business.service.statistics.impl;

import com.tuanzi.loan.business.repository.statistics.ApiFlowStatRepository;
import com.tuanzi.loan.business.service.statistics.ApiFlowStatService;
import com.tuanzi.loan.core.aspect.Debug;
import com.tuanzi.loan.core.vo.PageSearcher;
import com.tuanzi.loan.vo.request.check.CheckUserStatRequest;
import com.tuanzi.loan.vo.request.statistics.api.ApiFlowStatSearchRequest;
import com.tuanzi.loan.vo.response.statistics.api.ApiFlowStatSearchResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.retry.RetryException;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Objects;

/**
 * 撞库统计 业务层接口实现类
 *
 * created by chuIllusions_tan 20180727
 */
@Debug
@Service
@Transactional
@Retryable(value = { RetryException.class })
public class ApiFlowStatServiceImpl implements ApiFlowStatService {

    @Autowired
    private ApiFlowStatRepository apiFlowStatRepository;

    @Override
    public Page<ApiFlowStatSearchResponse> list(PageSearcher<ApiFlowStatSearchRequest> pageSearcher) {
        if (Objects.isNull(pageSearcher))
            throw new NullPointerException("pageSearcher is null");
        if (Objects.isNull(pageSearcher.getSearchCondition()) || Objects.isNull(pageSearcher.getPageable()))
            throw new NullPointerException("activityparticipatestatSearchRequest or pageable is null");
        return apiFlowStatRepository.list(pageSearcher.getSearchCondition(),pageSearcher.getPageable());
    }




}
